/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.easoft.code.pos.ui.controllers.impl;

import com.easoft.code.pos.data.pojos.Persona;
import com.easoft.code.pos.ui.controllers.DataEntryController;
import com.easoft.code.pos.ui.models.PojoListModel;
import com.easoft.code.pos.util.ComboItem;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Eliu
 */
public class PersonasControllerImpl extends DataEntryController<Persona> {

    public PersonasControllerImpl() {
        super(Arrays.asList(new String[]{"Codigo", "Nombre", "Razon Social",
            "Direccion", "Telefono", "Email", "Limite Credito", "Dias Credito", "Tipo Persona"}),
                Arrays.asList(new String[]{"Codigo", "Nombre",
                    "RazonSocial", "Direccion",
                    "Telefono", "Email", "LimiteCredito",
                    "DiasCredito", "TipoPersona"}), Persona.class,
                new Integer[]{0, 1, 2, 3, 5}, null);
        prepareComboTipoPersona();

    }

    private void prepareComboTipoPersona() {
        List<ComboItem> l = new LinkedList<>();
        l.add(new ComboItem("1", "Cliente"));
        l.add(new ComboItem("2", "Proveedor"));
        PojoListModel catMod = new PojoListModel(l);
        addNewModel("TipoPersona", catMod);
    }

    @Override
    public void reload() {
        super.reload();
        prepareComboTipoPersona();
    }
}
